Skip to content

crypto/secp256k1: update function receiver variable name to lower-case style#29889

Merged
fjl merged 1 commit into
ethereum:masterfrom
suiyuan1314:style/function-receiver
May 30, 2024
Merged

crypto/secp256k1: update function receiver variable name to lower-case style#29889
fjl merged 1 commit into
ethereum:masterfrom
suiyuan1314:style/function-receiver

Conversation

@suiyuan1314
Copy link
Copy Markdown
Contributor

No description provided.

@fjl fjl merged commit 2262bf3 into ethereum:master May 30, 2024
@fjl fjl added this to the 1.14.4 milestone May 30, 2024
jorgemmsilva pushed a commit to iotaledger/go-ethereum that referenced this pull request Jun 17, 2024
gzliudan pushed a commit to gzliudan/XDPoSChain that referenced this pull request Jan 4, 2025
eomti-wm pushed a commit to wemixarchive/go-wemix that referenced this pull request Mar 13, 2026
hominlee-wemade pushed a commit to wemixarchive/go-wemix that referenced this pull request May 19, 2026
* fix: use aes blocksize

Co-Authored-By: Gary Rong <garyrong0905@gmail.com>

* fix: ECIES invalid-curve handling (ethereum#33669)

Fix ECIES invalid-curve handling in RLPx handshake (reject invalid
ephemeral pubkeys early)
- Add curve validation in crypto/ecies.GenerateShared to reject invalid
public keys before ECDH.
- Update RLPx PoC test to assert invalid curve points fail with
ErrInvalidPublicKey.

Motivation / Context
RLPx handshake uses ECIES decryption on unauthenticated network input.
Prior to this change, an invalid-curve ephemeral public key would
proceed into ECDH and only fail at MAC verification, returning
ErrInvalidMessage. This allows an oracle on decrypt success/failure and
leaves the code path vulnerable to invalid-curve/small-subgroup attacks.
The fix enforces IsOnCurve validation up front.

* fix: define NDEBUG only if not defined (ethereum#27550)

* fix: harden secp256k1 validation and introduce EllipticCurve interface

* refactor: change receiver variable name to lowercase (ethereum#29889)

* refactor: remove hardcoded value for secp256k1.N (ethereum#30126)

* fix: add IsOnCurve check (ethereum#31100)

* feat: update libsecp256k1 (ethereum#31242)

Updates the libsecp256k1 dependency to commit:
c0d9480fbbf8eccbd4be23ed27f6f2af6f3b211e

PR:
```
BenchmarkSign-24    	   57756	     21214 ns/op	     164 B/op	       3 allocs/op
BenchmarkRecover-24    	   37156	     33044 ns/op	      80 B/op	       1 allocs/op
BenchmarkEcrecoverSignature-24    	   36889	     32935 ns/op	      80 B/op	       1 allocs/op
BenchmarkVerifySignature-24    	   41163	     29207 ns/op	       0 B/op	       0 allocs/op
BenchmarkDecompressPubkey-24    	  318624	      4062 ns/op	     304 B/op	       6 allocs/op
```

Master:
```
BenchmarkSign-24    	   34509	     35330 ns/op	     164 B/op	       3 allocs/op
BenchmarkRecover-24    	   25418	     47725 ns/op	      80 B/op	       1 allocs/op
BenchmarkEcrecoverSignature-24    	   25735	     47591 ns/op	      80 B/op	       1 allocs/op
BenchmarkVerifySignature-24    	   29108	     41097 ns/op	       0 B/op	       0 allocs/op
BenchmarkDecompressPubkey-24    	  294747	      4143 ns/op	     304 B/op	       6 allocs/op
```

Performance seems to be improved significantly:
```
Sign-24      34.86µ ± 3%   21.66µ ± 2%  -37.86% (p=0.000 n=10)
Recover-24   46.14µ ± 3%   33.24µ ± 2%  -27.95% (p=0.000 n=10)
```

* fix: coordinate check

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: fengjian <445077+fengjian@users.noreply.github.com>
Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>
Co-authored-by: SuiYuan <165623542+suiyuan1314@users.noreply.github.com>
Co-authored-by: zhiqiangxu <652732310@qq.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants